@import url('https://fonts.googleapis.com/css?family=Inter:opsz,wght@14..32,100..900&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Inter", sans-serif;
}

body {
  width: 100%;
  
  min-height: 100vh;
  background: linear-gradient(#F4F0FF, #DACDFF);
}
#chatbot-toggler{
  position: fixed;
  bottom: 30px;
  right: 35px;
  border: none;
  height: 50px;
  width: 50px;
  border-radius: 50%;
  
  display: flex;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  background: #6d4fc2;
  transition: all 0.2s ease;
}
#chatbot-toggler span{
  position: absolute;
  color: #fff;
}
/* .container.show-chatbot的意思是 */
.container.show-chatbot #chatbot-toggler{
  transform: rotate(-180deg);
}









.chatbot-popup {
  position: fixed;
  opacity: 0;
  pointer-events: none;
  bottom: 90px;
  right: 35px;
  width: 420px;
  overflow: hidden;
  transform: scale(0.2);
  transform-origin: bottom right;
  background-color: #fff;
  border-radius: 15px;
  box-shadow: 0 0 128px 0 rgba(0, 0, 0, 0.1), 0 32px 64px -48px rgba(0, 0, 0, 0.5);
  transition: all 0.1s ease;
  z-index: 1000;
}

.container.show-chatbot .chatbot-popup{
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}


.chatbot-popup .chat-header {
  display: flex;
  padding: 15px 22px;
  align-items: center;
  justify-content: space-between;
  background: #6d4fc2;
}

.chat-header .header-info {
  display: flex;
  gap: 10px;
  align-items: center;
}
.header-info .icon-bot{
  height: 35px;
  width: 35px;
  padding: 5px;
  font-size: 20px;
  background: #fff;
  text-align: center;
  border-radius: 50%;
  color: #6d4fc2;
  flex-shrink: 0;
}
.header-info .logo-text{
  color: #fff;
  font-size: 1.31rem;
  font-weight: 600;
}
.chat-header button{

  height: 40px;
  width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: none;
  outline: none;
  color: #fff;
  cursor: pointer;
  font-size: 1.9rem;
  padding-top: 2px;
  margin-right: -10px;
  background: none;
  transition: 0.2s ease;
}
.chat-header button:hover{
  background: #593bab;
}

.chat-body{
  display: flex;
  height: 460px;
  overflow-y: auto;
  padding: 25px 22px;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 82px;
  scrollbar-width: thin;
  scrollbar-color: #ddd3f9 transparent;
}
.chat-body .message{
  display: flex;
  gap: 11px;
  align-items: center;
}

.chat-body .message.error .message-text{
  color:#ff0000;
}


.chat-body .bot-message .icon-bot{
  height: 35px;
  width: 35px;
  
  padding: 5px;
  font-size: 20px;
  background:#6d4fc2;
  text-align: center;
  border-radius: 50%;
  color: #fff;
  flex-shrink: 0;
}

.chat-body .message .message-text{
  padding: 12px 16px;
  max-width: 75%;
  word-wrap: break-word;
  white-space: pre-line;
  font-size: 0.95rem;
}
.chat-body .bot-message .message-text{
  background: #f6f2ff;
  border-radius: 13px 13px 13px 3px;
}

.chat-body .user-message{
  flex-direction: column;
  align-items: flex-end;
}

.chat-body .user-message .message-text{
  color: #fff;
  background:#6d4fc2;
  border-radius: 13px 13px 3px 13px;
}

.chat-footer{
  position: absolute;
  bottom: 0;
  width: 100%;
  background: #fff;
  padding: 15px 22px 20px;
}
.chat-footer .chat-form{
  display: flex;
  align-items: center;
  background:#fff;
  outline: 1px solid #cccce5;
  border-radius: 32px;
  box-shadow: 0 0 8px rgba(0,0,0,0.06);
}
/* :focus-within意思是当元素或其子元素获得焦点时，触发样式 */
.chat-footer .chat-form:focus-within{
  outline: 2px solid #6d4fc2;
}

.chat-form .message-input{
  border: none;
  outline: none;
  background: none;
  width: 100%;
  height: 47px;
  padding:0 17px;
  font-size: 0.95rem;

}
.chat-form button{
  height: 35px;
  width: 35px;
  border:none;
  outline: none;
  cursor: pointer;
  display: none;
  font-size: 1.15rem;
  color: #fff;
  flex-shrink: 0;
  margin-right: 6px;
  border-radius: 50%;
  background: #6d4fc2;
  transition: 0.2s ease;
}
.chat-form button:hover{
  background: #593bab;
}
/* :valid表示输入有效，:invalid表示输入无效 以下代码意思是当输入有效时显示按钮 */
.chat-form .message-input:valid~button{
  display: block;
}
.footMsg{
  width: 100vw;
  height: 50px;
  position: absolute;
  bottom: 0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  
}


/* 媒体查询 */
@media (max-width: 520px) {
  #chatbot-toggler{
    right: 20px;
    bottom: 20px;
  }

  .chatbot-popup{
    right: 0;
    bottom: 0;
    height: 100%;
    border-radius: 0;
    width: 100%;
  }

  .chatbot-popup .chat-header{
    padding: 12px 15px;
  }

  .chat-body{
    height: 550px;
    padding: 25px 15px;
    margin-bottom: 20px;
  }

  .chat-footer{
    padding: 10px 15px 15px;
  }
}